<script>
	import {
		mapMutations
	} from 'vuex';
	export default {
		methods: {
			...mapMutations(['login'])
		},
		onLaunch: function() {
			let that = this;
			uni.login({
				success(res) {
					console.log(res);
					uni.request({
						url: "https://fc.jixuantiant.com/applet.php?suid=gaus0xcyuh",
						data: {
							map: 'applet_member_info',
							code: res.code,
							slient: 1
						},
						success(ret) {
							if (ret.data.ec == 200) {
								that.login(ret.data.data);
							}
						}

					})
					// that.http('applet_member_info', {
					// 	slient: 1,
					// 	code: res.code
					// },'get').then(ret => {
					// 	console.log(ret.data)
					// 	that.login(ret.data);
					// })
				}
			});
			const updateManager = uni.getUpdateManager();

			updateManager.onCheckForUpdate(function(res) {
				// 请求完新版本信息的回调
				console.log(res.hasUpdate);
			});

			updateManager.onUpdateReady(function(res) {
				uni.showModal({
					title: '更新提示',
					content: '新版本已经准备好，是否重启应用？',
					success(res) {
						if (res.confirm) {
							// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
							updateManager.applyUpdate();
						}
					}
				});

			});

			updateManager.onUpdateFailed(function(res) {
				// 新的版本下载失败
			});
		},
		onShow: function() {

		},
		onHide: function() {
			console.log('App Hide')
		},
		globalData: {
			base_url: "https://fc.jixuantiant.com/applet.php?suid=gaus0xcyuh",
			root_url: "https://fc.jixuantiant.com/"
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";

	.content {
		display: flex;
		flex-direction: column;
	}

	.copyright {
		width: 100%;
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;

		image {
			width: 500rpx;
			height: 50rpx;
		}
	}

	.empty {
		width: 100%;
		height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>
